{% extends "base.html" %}

{% block header%}
<title>机器(ID:{{model.id}})任务列表</title>
{% endblock %}

{% block content %}
{% with model_name='MachineTask' base_url='/pack/machine/machine_task' url_prefix='/pack/machine/machine_task_detail' %}
<script type="text/javascript">
    var request_url = '/pack/machine/machine_task',
        ColumnDefs = [
            {
                "aTargets": [2],
                "sWidth":"18%",
                "mData": function (source) {
                        return "<a href='javascript: void(0);' onclick='del{{model_name}}(" +
                            source[2] + ")'>删除</a>"
                }
            },

        ];
	function add{{model_name}}(ele) {
		art.dialog.open("{{url_prefix}}?id={{model.id}}")
	}

	function del{{model_name}}(id){
		if (confirmRandom('确定删除吗?')){
            $.ajax({
               url:'{{base_url}}?id='+id,
               type:'DELETE',
               success:function (result) {
                    if(result){
                       window.location.reload();
                   }else{
                       alert("删除失败！")
                   }
               }
           })
		}
	}

</script>

{% include 'query/plugins/search_form.html' %}

<div >
	<ul id="nav-list" class="nav nav-tabs" >
			  <li class="active"  >
			  	<a>机器任务列表</a>
			  </li>
	</ul>
	<!-- 按钮工具条 -->
	<div id='datatable_toolbar'>
		<div class="btn-toolbar pull-right">
			<div class="btn-group ">
				<a class="btn btn-sm btn-success " onclick="add{{model_name}}(this)">
					<i class="icon-plus-sign"></i>添加
				</a>
			</div>
		</div>
	</div>
	<table id="{{model_name}}_table" class="table table-bordered datatable" data-toolbar='datatable_toolbar' data-group-by-index='[5]'>
		<thead>
		<tr>
			<th>项目</th>
			<th>任务</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody id="{{model_name}}_area"></tbody>
	</table>
</div>
{% endwith %}
{% endblock %}
